function auc=AUC_vs_N_study(dt,nn)

%AUC_vs_N_study studies dependency between sample size and AUC for a NRN model
%Syntax: auc=AUC_vs_N_study(dt)
%Description: dt is a structure of the type created by create_dt and auc is
%structure with the results of each of the samping experiments. nn is a two
%column matrix where thefirst colun sets the sampling size and teh seccond
%teh number of repeats.
%
%Jonas Almeida 2007 May 22


if isstruct(dt) % then this is the regular use of the function
    n=size(dt.nx,1);
    if nargin<2
        S=round(n/10);
        nn=[S:S:n-S];
        nn=[nn',S*ones(length(nn),1)];
    end


    auc=[];
    for i=1:size(nn,1) %each sampling
        for j=1:nn(i,2)
            aucij=AUC4N(dt,nn(i,1));
            auc=[auc;nn(i,1),aucij];
            disp(auc(end,:))
        end
    end

else % this function is now being used to display the auc results
    auc=dt;
    %Plot individual results
    plot(auc(:,1),auc(:,2),'o')
    hold on
    %find medians
    U=unique(auc(:,1));
    UU=zeros(length(U),2);
    for i=1:length(U)
        UU(i,1)=U(i);
        UU(i,2)=median(auc(find(auc(:,1)==U(i)),2));
    end
    plot(UU(:,1),UU(:,2),'-o','LineWidth',3)
    grid on
    ax=axis;ax(3)=max([ax(3),0.4]);axis(ax);
    xlabel('Number of samples')
    ylabel('Area under the ROC cureve (AUC)')
    title('Predictive accuracy for test data (by resampling)')
    

        
    
    
end





%auc=[];